// ----------------------------------------------------------------------------
// markItUp!
// ----------------------------------------------------------------------------
// Copyright (C) 2008 Jay Salvat
// http://markitup.jaysalvat.com/
// ----------------------------------------------------------------------------
// Html tags
// http://en.wikipedia.org/wiki/html
// ----------------------------------------------------------------------------
// Basic set. Feel free to add more tags
// ----------------------------------------------------------------------------

htmlEditorSettings = {
	nameSpace:      "html",
	onShiftEnter:	{keepDefault:false, replaceWith:'<br />\n'},
	onCtrlEnter:	{keepDefault:false, openWith:'\n<p>', closeWith:'</p>\n'},
	onTab:			{keepDefault:false, openWith:'	 '},
	markupSet: [
		{name:'Заголовок 1', key:'1', openWith:'<h1(!( class="[![Class]!]")!)>', closeWith:'</h1>', placeHolder:'Your title here...' },
		{name:'Заголовок 2', key:'2', openWith:'<h2(!( class="[![Class]!]")!)>', closeWith:'</h2>', placeHolder:'Your title here...' },
		{name:'Заголовок 3', key:'3', openWith:'<h3(!( class="[![Class]!]")!)>', closeWith:'</h3>', placeHolder:'Your title here...' },
		{name:'Заголовок 4', key:'4', openWith:'<h4(!( class="[![Class]!]")!)>', closeWith:'</h4>', placeHolder:'Your title here...' },
		{name:'Заголовок 5', key:'5', openWith:'<h5(!( class="[![Class]!]")!)>', closeWith:'</h5>', placeHolder:'Your title here...' },
		{name:'Заголовок 6', key:'6', openWith:'<h6(!( class="[![Class]!]")!)>', closeWith:'</h6>', placeHolder:'Your title here...' },
		{name:'Параграф', openWith:'<p(!( class="[![Class]!]")!)>', closeWith:'</p>' },
		{name:'Лид', openWith:'<p class="lid">', closeWith:'</p>' },
		{separator:'---------------' },
		{name:'Жирный', key:'B', openWith:'(!(<strong>|!|<b>)!)', closeWith:'(!(</strong>|!|</b>)!)' },
		{name:'Наклонный', key:'I', openWith:'(!(<em>|!|<i>)!)', closeWith:'(!(</em>|!|</i>)!)' },
		{name:'Перечеркнутый', key:'S', openWith:'<del>', closeWith:'</del>' },
		{separator:'---------------' },
		{name:'Список', openWith:'<ul>\n', closeWith:'</ul>\n' },
		{name:'Нумерованный список', openWith:'<ol>\n', closeWith:'</ol>\n' },
		{name:'Элемент списка', openWith:'<li>', closeWith:'</li>' },
		{separator:'---------------' },
		{name:'Изображение', key:'P', replaceWith:'<img src="[![Source:!:http://]!]" alt="[![Alternative text]!]" />' },
		{name:'Гиперссылка', key:'L', openWith:'<a href="[![Link:!:http://]!]"(!( title="[![Title]!]")!)>', closeWith:'</a>', placeHolder:'Your text to link...' },
		{separator:'---------------' },
		{name:'Цвет', className:'colors', dropMenu: [
            {name:'Orange',  openWith:'<span style="color:#e8d7c8">', closeWith:'</span>', className:"col2-1" },
            {name:'Orange',  openWith:'<span style="color:#eb6710">', closeWith:'</span>', className:"col2-2" },
            {name:'Orange',  openWith:'<span style="color:#c6570d">', closeWith:'</span>', className:"col2-3" },
            {name:'Blue',   openWith:'<span style="color:#d1e2ed">', closeWith:'</span>', className:"col4-1" },
            {name:'Blue',   openWith:'<span style="color:#70bced">', closeWith:'</span>', className:"col4-2" },
            {name:'Blue',   openWith:'<span style="color:#324567">', closeWith:'</span>', className:"col4-3" },
            {name:'Blue',    openWith:'<span style="color:#2c60ae">', closeWith:'</span>', className:"col5-1" },
            {name:'Blue',    openWith:'<span style="color:#153c95">', closeWith:'</span>', className:"col5-2" },
            {name:'Blue',    openWith:'<span style="color:#152972">', closeWith:'</span>', className:"col5-3" },
            {name:'Gray',    openWith:'<span style="color:#FFFFFF">', closeWith:'</span>', className:"col8-1" },
            {name:'Gray',    openWith:'<span style="color:#d1d2d2">', closeWith:'</span>', className:"col8-2" },
            {name:'Gray',    openWith:'<span style="color:#BABDB6">', closeWith:'</span>', className:"col8-3" },
            {name:'Gray',    openWith:'<span style="color:#626665">', closeWith:'</span>', className:"col9-1" },
            {name:'Gray',    openWith:'<span style="color:#414242">', closeWith:'</span>', className:"col9-2" },
            {name:'Gray',    openWith:'<span style="color:#000000">', closeWith:'</span>', className:"col9-3" }
            ]
        },
        {name:'Таблицы стилей', className:'styles', dropMenu: [
            {name:'Сноска',  openWith:'<div class="announce">', closeWith:'</div>', className:"col1-1" },
            ]
        },
        {separator:'---------------' },
        //{name:'Очистить', className:'clean', replaceWith:function(markitup) { return markitup.selection.replace(/<(.*?)>/g, "") } },
		{name:'Предварительный просмотр', className:'preview', call:'preview' },
		{name:'Файловый менеджер', className:'filemanager', openWith:'',  closeWith:'', beforeInsert:function(h) { markitupFilemanager(h); }},
	]
}

	function markitupFilemanager(h) {
		
		var selector = h.textarea.id;
		
		$('<iframe src="/control/browser/files/iframe/true/for/markitup/selector/'+selector+'/"></iframe>').phormDialog();
		
	}

